<script language="javascript" src="../js/hotelLib.js" type="text/javascript"></script>
<script language="javascript" src="../js/utils.js" type="text/javascript"></script>
<font color="#FFFFFF">
<?php
	require_once "../classes/ReportesConsultas.php";
	
	if(isset($_REQUEST['accion'])){
		
		$profile=get_object_vars(unserialize($_SESSION['userProfile']));
		$tipoProcedencia = $profile['data']['tipo_procedencia'];
		if($tipoProcedencia == 'Hotel'){
			$idHotel = $profile['data']['id_procedencia'];
			$esHotel = true;
		}else{
			//Acción cuando el que consulta la papeleta no es el Hotel
			$idAgencia = $profile['data']['id_procedencia'];
		}
		$idPapeleta = $_REQUEST['noPapeleta'];
		$consulta = new ReportesConsultas();
		
		if($esHotel) $papel = $consulta->getPapeleta($idHotel,$idPapeleta);
		else $papel = $consulta->getPapeletaAgencia($idAgencia,$idPapeleta);

		echo "
			<table width='600' border='0' cellpadding='0' cellspacing='0'>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>No. Reservaci&oacute;n:</td>
					<td class='formtitle'>{$papel['IdReservacion']}</td>
					<td class='formLabel' valign='top' align='right' nowrap>No. Papeleta:</td>
                    <td class='formtitle'>{$idPapeleta}</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Destino:</td>
					<td class='formtitle'>{$papel['Destino']}</td>
                    <td colspan='2'>&nbsp;</td>
				</tr>";
		if($tipoProcedencia != 'Hotel'){
			echo	"
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Hotel:</td>
					<td class='formtitle'>{$papel['Hotel']}</td>
					<td class='formLabel' valign='top' align='right' nowrap>Direcci&oacute;n:</td>
                    <td class='formtitle'>{$papel['DireccionHotel']}</td>
				</tr>";
		}
		echo	"
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Cliente:</td>
					<td class='formtitle'>{$papel['Cliente']}</td>
                    <td colspan='2'>&nbsp;</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Estancia:</td>
					<td class='formtitle' align='left'>del {$papel['FechaI']} <br>al {$papel['FechaT']}</td>
					<td class='formLabel' valign='top' align='right' nowrap>Noches:</td>
					<td class='formtitle' valign='top'>{$papel['Noches']}&nbsp;</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Ocupaci&oacute;n:</td>
					<td class='formtitle'>{$papel['Adultos']} Adulto(s),<br>
					{$papel['Juniors']} Junior(s),<br>
					{$papel['Menores']} Menor(es)</td>
					<td colspan='2'>&nbsp;</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Tipo de Habitaci&oacute;n:</td>
					<td class='formtitle'>{$papel['TipoHab']}</td>
                    <td colspan='2'>&nbsp;</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Solicitud Especial:</td>
					<td class='formtitle'>{$papel['SolicitudEspecial']}</td>
                    <td colspan='2'>&nbsp;</td>
				</tr>
				<tr>
					<td class='formLabel' valign='top' align='right' nowrap>Costo de Reservaci&oacute;n:</td>
					<td class='formtitle'>\${$papel['CostoReservacion']}</td>
					<td class='formLabel' valign='top' align='right' nowrap>Estado:</td>
					<td class='formtitle'>{$papel['Status']}</td>
				</tr>
			</table>
            <hr>
            <div align='justify' class='formLabel'> {$papel['Leyenda']} </div>
";

	}else{
		
		echo"
		<form name=\"form\" id=\"formaPapeleta\" action=\"Papeletas.php\" method=\"post\">
			<input type=\"hidden\" value=\"papeleta\" name=\"accion\" />
			<input type=\"hidden\" value=\"5\" name=\"seccion\" />
		
			<table width=\"600\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
				<tr>
					<td align=\"right\" width=\"50%\" class=\"formtitle\"> Número de Papeleta a Buscar:</td>
					<td align=\"left\" width=\"50%\"> <input type=\"text\" name=\"noPapeleta\" id=\"noPapeleta\"/> </td>
				</tr>
				<tr>
					<td colspan=\"2\" align=\"center\"> <input type=\"button\" value=\"Consultar\" onClick=\"validarPapeleta();\"/></td>
				</tr>
			</table>
		</form>";
	}
?>
</font>